package com.hdyg.sixg.mvp.presenter;

import com.hdyg.sixg.entry.MiniBean;
import com.hdyg.sixg.httpUtil.HttpCallback;
import com.hdyg.sixg.mvp.Contrant.CFragMini;
import com.hdyg.sixg.mvp.base.BasePresenter;
import com.hdyg.sixg.util.ToastUtil;
import java.util.Map;

/**
 * @author CZB
 * @describe 矿机
 * @time 2019/4/10 9:54
 */
public class PFragMini extends BasePresenter implements CFragMini.IPFragMini {

    private CFragMini.IVFragMini mView;

    public PFragMini(CFragMini.IVFragMini mView) {
        this.mView = mView;
    }

    @Override
    public void pGetInit(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback<MiniBean>(true) {
            @Override
            public void onSuccess(MiniBean loginBean) {
                mView.vGetInitSuccess(loginBean);
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }

    @Override
    public void pGetActive(String path, Map<String, String> params) {
        mModel.post(path, params, new HttpCallback(true) {
            @Override
            public void onSuccess(Object loginBean) {
                mView.vGetActiveSuccess(loginBean.toString());
            }

            @Override
            public void onFail(String code, String error) {
                ToastUtil.show(error);
            }
        });
    }
}
